package controller.commands;

import controller.IListener;
import model.graphic.objects.GBoxNode;
import view.GUI.graphic.GraphicView;

/**
 *
 * @author Ben
 */
public class ZoomBoxNodeCommand extends BasicCommand{
    private GBoxNode gboxnode;

    public ZoomBoxNodeCommand(GraphicView gview, GBoxNode gboxnode) {
        this.gview = gview;
        this.gboxnode = gboxnode;
    }

    @Override
    public void execute() {
      GraphicView gv = new GraphicView(gboxnode.getGraphicModel(),cmodel);

      //add all listeners
      for(IListener listener : gview.getObservers()){
          gv.addObserver(listener);
      }
      //add all observers
      gboxnode.getGraphicModel().deleteObservers();
      gboxnode.getGraphicModel().addObserver(controller.getPropertiesPanel());
      gboxnode.getGraphicModel().addObserver(controller.getStatusbar());

      //add extra tab
      controller.addViewTab(gboxnode.getName(), gv,true);
    }
}
